home *** CD-ROM | disk | FTP | other *** search
-
- #include <exec/types.h>
- #include <exec/ports.h>
- #include <proto/exec.h>
-
- #define PORT_NAME "MusicalDiceGame_Port"
-
- struct MsgPort *ZuluPortP;
-
-
- #define ACT_QUIT 1
- #define ACT_PLAY 2
- #define ACT_STOP 3
- #define ACT_CONTINUE 4
- #define ACT_NEW 5
-
- struct Musical_Message {
-
- struct Message mdg_Message;
- UWORD mdg_Action; /* see above */
- UWORD mdg_Unused;
- };
-
- struct Musical_Message ask;
-
-
-
- main(int argc, char **argv) {
-
- UWORD action = 0;
-
- if (argc != 2) {
- printf("Usage: DiceCommand [quit|play|stop|continue|new]\n");
- exit(NULL);
- }
-
- /* select command */
- if (strcmp(argv[1],"quit") == 0) action = ACT_QUIT;
- if (strcmp(argv[1],"play") == 0) action = ACT_PLAY;
- if (strcmp(argv[1],"stop") == 0) action = ACT_STOP;
- if (strcmp(argv[1],"continue") == 0) action = ACT_CONTINUE;
- if (strcmp(argv[1],"new") == 0) action = ACT_NEW;
-
- if (! action) {
- printf("Usage: DiceComm [quit|play|stop|continue|new]\n");
- exit(NULL);
- }
-
- ask.mdg_Message.mn_Length = sizeof(struct Musical_Message);
- ask.mdg_Action = action;
-
- Forbid();
-
- /* find Musical Dice Game message port */
- ZuluPortP = FindPort(PORT_NAME);
-
- if (ZuluPortP) {
- PutMsg(ZuluPortP, &ask); /* send command */
- }
- else {
- printf("Musical Dice Game not active.\n");
- }
- Permit();
- }
-